#include <2025Linux.h>
typedef struct student_s {
    int num;
    //char *name;
    char name[20]; //推荐用这种方法，因为文件里面一般不保存指针
    float score;
} student_t;
int main(int argc, char *argv[])
{
    // ./04_student_read file1
    ARGS_CHECK(argc,2);
    int fd = open(argv[1],O_RDWR);
    student_t stu[3];//保存将要读取的数据
    read(fd,stu,sizeof(stu));
    for(int i = 0; i < 3; ++i){
        printf("num = %d, name = %s, score = %f\n",
               stu[i].num, stu[i].name, stu[i].score);
    }
    close(fd);
    return 0;
}

